<template>
	<view class="page">
		<view class="list">
			<view class="item">
				<text class="key">作者姓名</text>
				<text class="value">{{name}}</text>
			</view>
			<view class="item">
				<text class="key">创建日期</text>
				<text class="value">{{createTime}}</text>
			</view>
		</view>
		<view class="box-bg">
			<uni-nav-bar shadow left-icon="left" dark :title="createTime+'日报'"/>
		</view>
		<view class="textarea">
			<text>
				{{txt}}
			</text>
		</view>
	</view>
</template>

<script>
	import uniNavBar from '@/components/uni-nav-bar/uni-nav-bar.vue'
	import uniTitle from '@/components/uni-title/uni-title.vue';
	export default {
		components: {
			uniTitle,
			uniNavBar
		},
		data() {
			return {
				//当前日报id
				id:0,
				//用户姓名
				name:'',
				//创建时间
				createTime:'',
				//日报记录
				txt:''
			}
		},
		onLoad:function(options){
			let that = this;
			that.id = options.id;
			if(options.id==null||options.id==''){
				uni.showToast({
					icon: "error",
					title: "不存在",
					complete: function() {
						setTimeout(function() {
							uni.navigateBack({
								delta: 1
							});
						}, 1000)
					}
				})
			}
		},
		onShow() {
			let that = this;
			uni.setNavigationBarTitle({
				title: '日报记录'
			});
			that.loadWorkDailyDetial(that);
		},
		methods: {
			loadWorkDailyDetial(ref){
				let that = this;
				that.ajax(that.url.searchWorkDailyDetialById, "POST", {
					"id": that.id
				}, function(resp) {
					let result = resp.data.data;
					let message = '暂无'
					if(result.user.name=='' || result.user.name==null){
						that.name = message;
					}else{
						that.name = result.user.name;
					}
					if(result.createTime=='' || result.createTime==null){
						that.createTime = message;
					}else{
						that.createTime = that.formatDataTime(result.createTime)
					}
					if(result.content == '' || result.content == null){
						that.txt = message;
					}else{
						that.txt = result.content;
					}
				});
			}
		}
	}
</script>

<style lang="less">
@import url('wrok_daily_detial.less');
</style>
